package com.atguigu.gmall.item.test;


import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.function.BiConsumer;

public class CompletableFutureDemo {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        CompletableFuture<String> stringCompletableFuture = CompletableFuture.supplyAsync(() -> {
            System.out.println(Thread.currentThread().getName() + "::hello");
            return "hello1";
        });

        stringCompletableFuture.whenCompleteAsync((t, e) -> {
            System.out.println(Thread.currentThread().getName()+"::"+t);
        });
    }
}
